package com.mz.mattress.api.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * 订单状态
 * 0未支付 1已取消 2已支付 3已发货 4已消费
 */
public enum OrderStatusEnum {

    INIT(0, "未支付"),   //未支付
    CANCEL(1, "已取消"),   //已取消
    PAID(2, "已支付"),     //已支付

//    HAS_SEND(3, "已发货"),   //已发货
    HAS_CONSUME(4, "已消费"),   //已消费
    //    Refund(3, ""),   //已发货

    APPLY_REFUND(6, "申请退款"),
    REJECT_REFUND(7, "拒绝退款"),
    HAS_REFUND(8, "已退款"),

    ;

    private Integer value;

    private String desc;

    OrderStatusEnum(final Integer value, final String desc) {
        this.value = value;
        this.desc = desc;
    }

    private static Map<Integer, OrderStatusEnum> map = new HashMap<>();

    static {
        for (OrderStatusEnum stepEnum : OrderStatusEnum.values()) {
            map.put(stepEnum.value, stepEnum);
        }
    }

    public static OrderStatusEnum valueOf(int value) {
        return map.get(value);
    }

    public Integer getValue() {
        return this.value;
    }

    public String getDesc() {
        return this.desc;
    }
}
